﻿<?xml version="1.0" encoding="utf-8"?><Articles><Article><ArticlesID>907</ArticlesID><Title>Javascript tạo Popup hiện ra giữa m&amp;#224;n h&amp;#236;nh</Title><Body>&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;H&amp;amp;agrave;m Javascript sau sẽ mở ra một popup v&amp;amp;agrave;o giữa m&amp;amp;agrave;n h&amp;amp;igrave;nh:&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
function openWin(pageUrl, w, h) {
    width = w;
    height = h;
    top_val = (screen.height - height) / 2 - 30;
    if (top_val &amp;amp;lt; 0) { top_val = 0; }
    left_val = (screen.width - width) / 2;

    window.open(pageUrl, null, &amp;amp;quot;toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=0,width=&amp;amp;quot; + width + &amp;amp;quot;,height=&amp;amp;quot; + height + &amp;amp;quot;, top=&amp;amp;quot; + top_val + &amp;amp;quot;,left=&amp;amp;quot; + left_val);
}
&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;C&amp;amp;aacute;c tham số nhận v&amp;amp;agrave;o:&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;pageUrl:&amp;amp;nbsp;đường dẫn cho popup&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;w:&amp;amp;nbsp;chiều rộng của popup&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;h: chiều cao của popup&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Sử dụng:&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: xhtml;&amp;quot;&amp;gt;
&amp;amp;lt;a href=&amp;amp;quot;javascript:void(0);&amp;amp;quot; onclick=&amp;amp;quot;openWin('http://dev.meotom.net',400,400);&amp;amp;quot;&amp;amp;gt;CLICK TO OPEN POPUP&amp;amp;lt;/a&amp;amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Demo&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;javascript:openWin('http://dev.meotom.net',400,400);&amp;quot;&amp;gt;Click to Open Popup&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;</Body><CommentEnabled>True</CommentEnabled><ViewCount>0</ViewCount><ReleaseDate>5/8/2010 8:27:36 AM</ReleaseDate><TotalComment>0</TotalComment><IsMedia>False</IsMedia><IsPicture>False</IsPicture><IsVote>True</IsVote><ArticlePassword /><PostVisible>0</PostVisible><ArticlePath>/2010/5/3/Javascript-tao-Popup-hien-ra-giua-man-hinh-38B</ArticlePath><Approved>True</Approved><ImagePath /><CategoryId>30</CategoryId><ArrayCatID>30|25</ArrayCatID></Article></Articles>